#ifndef TIMER1_H_INCLUDED
#define TIMER1_H_INCLUDED
#include <avr/io.h>

extern const Message * const timer1Caputre;

static const uint8_t TC1_CK1024	= _BV(CS12) | _BV(CS10);
static const uint8_t TC1_CK256	= _BV(CS12);
static const uint8_t TC1_CK64	= _BV(CS11) | _BV(CS10);
static const uint8_t TC1_CK8	= _BV(CS11);
static const uint8_t TC1_CK1	= _BV(CS10);
static const uint8_t ICP1CONF	= _BV(ICNC1);
void timer1Init( void );
void timer1SetNotice( pMsgBox mb );
inline UINT32 timer1GetCount( void );
/* 开始计数，启动输入捕捉中断 */
void timer1Start( uint8_t ck );
static inline void timer1Stop( void )
{
	CBI( TIMSK, TICIE1 );
	TCCR1B = 0;
}
static inline unsigned timer1ConvertToMs( uint32_t cnt, uint16_t ck )
{
	uint32_t permsec = F_CPU / ck / 1000;
	return ( cnt / permsec );
}
#endif /* TIMER1_H_INCLUDED */
